package edu.noteBook.dao;

import edu.noteBook.Pojo.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
public interface UserDao {
    /**
     * 通过账号密码进行用户登录
     * @param username
     * @param password
     * @return User
     */
    User login(@Param("username") String username, @Param("password") String password);
    /**
     * 通过用户名，邮箱模糊查询用户
     * @param username
     * @return User
     */
    List<User> queryUser(@Param("username") String username, @Param("email") String email);

    /**
     * 增删改
     * @param user
     * @return int
     */
    int addUser(User user);

    int deleteUser(@Param("id") Integer id);

    int updateUser(User user);

    User queryUserByEmail(@Param("email") String email);

    User queryUserById(@Param("id") Integer id);
}
